{% extends "management/base.html" %}
{% load staticfiles %}
{% block title %}查看图集{% endblock %}

{% block content %}

    <div class="container">
        <div class="row">
            <div class="col-md-6 col-md-offset-6" style="margin-top: 0%">
                <h2 class="fontmain">{{ group.name }}</h2>
            </div>
        </div>
        <div class="row">
            <div class="col-md-2">
                <label class="text-center">关联数据</label>
                {% if group.table_set.all %}
                    <table class="table table-hover">
                        {% for table in group.table_set.all %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td><a href="{% url 'media' table.file %}">{{ table.name }}</a></td>
                            </tr>
                        {% endfor %}
                    </table>
                {% else %}
                    <p>暂无关联数据</p>
                {% endif %}
                <label class="text-center">信息</label>
                <table class="table table-hover">
                    <tr>
                        <td>发布者</td>
                        <td>{{ group.author }}</td>
                    </tr>
                    <tr>
                        <td>图集类别</td>
                        <td>{{ group.category }}</td>
                    </tr>
                </table>
            </div>
            <div class="col-md-10">
                {% if group.img_set.all %}
                    <div id="carousel-generic" class="carousel slide" data-ride="carousel">
                        <ol class="carousel-indicators">
                            {% for img in group.img_set.all %}
                                <li data-target="#carousel-generic" data-slide-to="{{ forloop.counter0 }}"
                                    {% if forloop.first %}class="active"{% endif %}></li>
                            {% endfor %}
                        </ol>
                        <div class="carousel-inner" role="listbox">
{#                            <div class="col-md-10 col-md-offset-1">#}
                                {% for img in group.img_set.all %}
                                    <div {% if forloop.first %}class="item active"{% else %}class="item"{% endif %}>
                                        <a href="{% url 'media' img.img %}"><img class="img-rounded img-responsive center-block" src="{% url 'media' img.img_md %}"></a>

                                        <div class="carousel-caption">
                                            {% if img.name %}
                                                <h3 class="black_shadow">{{ img.name }}</h3>
                                            {% endif %}
                                            {% if img.description %}
                                                <p class="black_shadow">{{ img.description }}</p>
                                            {% endif %}
                                        </div>
                                    </div>
                                {% endfor %}
                            </div>

                        </div>
                        <a class="left carousel-control" href="#carousel-generic" role="button" data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left"></span>
                        </a>
                        <a class="right carousel-control" href="#carousel-generic" role="button" data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right"></span>
                        </a>
                    </div>
                {% else %}
                    <p class="text-center">暂无图片</p>
                {% endif %}
            </div>
        </div>
        <div>
        </div>
    </div>

{% endblock %}